<#import "macro.html" as m>
    <@m.page_header title='主页' />

    <div class="wrapper wrapper-content gray-bg">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">

                    <div class="ibox-content">
                        <h2>我的相册</h2>
                        <div class="ibox-tools">
                            <a href="/admin/addPhoto" class="btn btn-primary btn-xs">添加新图片</a>
                            <a href="/admin/addPhotoBatch" class="btn btn-primary btn-xs">批量添加</a>
                        </div>
                        <table class="table table-hover ">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>名称</th>
                                <th>图片</th>
                                <th>描述</th>
                                <th>是否置顶</th>
                                <th>是否推荐</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#list photos.content as p>
                                <tr>
                                    <td>${p.id?c}</td>
                                    <td>${p.title!!}</td>
                                    <td><a href="${p.link}" title="图片" data-gallery=""><img src="${p.link}" width="40" height="40"></a></td>
                                    <td>${p.description!!}</td>
                                    <td>${p.placedTop?string('是','否')}</td>
                                    <td>${p.recommend?string('是','否')}</td>
                                    <td>${p.createDate!!}</td>
                                    <td><a href="/admin/delPhoto/${p.id?c}" class="btn btn-primary btn-xs">删除</a></td>
                                </tr>
                            </#list>
                            </tbody>
                        </table>
                        <div class="pagination" id="pagination"></div>  <!--- 分页 -->

                        <div class="lightBoxGallery">
                            <div id="blueimp-gallery" class="blueimp-gallery">
                                <div class="slides"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <link href="/static/admin/css/plugins/blueimp/css/blueimp-gallery.min.css" rel="stylesheet">

    <script src="/static/admin/js/jqPaginator.js"></script>
    <script src="/static/admin/js/content.min.js?v=1.0.0"></script>
    <script src="/static/admin/js/plugins/blueimp/jquery.blueimp-gallery.min.js"></script>
    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>

    <script>
        $(function () {
            try {
                $('#pagination').jqPaginator({
                    totalPages: ${photos.totalPages},
                    visiblePages: 7,
                    currentPage: ${photos.number+1},
                    first: '<li class="first"><a href="javascript:void(0);">首页</a></li>',
                    prev: '<li class="prev"><a href="javascript:void(0);"><i class="arrow arrow2"></i>上一页</a></li>',
                    next: '<li class="next"><a href="javascript:void(0);">下一页<i class="arrow arrow3"></i></a></li>',
                    last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
                    page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
                    onPageChange: function (num, type) {
                        if (type == 'change') {
                            location.href = "/admin/photo?page=" + (num - 1);
                        }
                    }
                });
            } catch (e) {
            }
        });
    </script>

    <@m.page_footer />